import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/rbac/login',
    method: 'get',
    params: data
  })
}

export function getInfo(token) {
  return request({
    url: '/rbac/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/rbac/logout',
    method: 'get'
  })
}

/**
 * 根据角色id获取路由
 * @param {*} id 
 * @returns 
 */
export function getRouters(id){
  return request({
    url:'rbac/menu/list2',
    method:'get',
    params:{id}     //data为用户角色id
  })
}

/**
 * 根据角色id获取路由
 * @param {*} id 
 * @returns 
 */
 export function getAllRouters(){
  return request({
    url:'rbac/menu/list1',
    method:'get',
  })
}
/**
 * 更新路由
 * @param {*} id 
 * @returns 
 */
 export function updateRoutes(id,data){
  return request({
    url:'rbac/menu/updateRoute',
    method:'post',
    params:{id},
    data
  })
}
